from PyQt5 import QtCore, QtGui, QtWidgets
from LoginWin import Ui_LoginWindow
from LognDo import LoginDo as login

#登录行为
class login_do(Ui_LoginWindow):
    def getUser(self):
        # print(self.uname.text())
        #判断是否存在用户名
        username = self.uname.text()
        userpass = self.upass.text()
        if username == '':
            self.msg.setText('用户名不能为空')
        elif userpass == '':
            self.msg.setText('密码不能为空')
        else:
            # self.msg.setText('')
            user = login(username, userpass)
            is_login = user.isLogin()
            #print(is_login)
            if is_login == 1:
                self.msg.setText('登录成功')
            else:
                self.msg.setText('用户名或密码不正确')



if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = login_do()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())